using System;
using System.Collections.Generic;

using EntModApp.EntServices.Data;

namespace DemoApp.DataAccess 
{
  public static class FavoriteDerivedPropertyNames
  {
    public const string DateOfCreation = @"DateOfCreation"; 

    public const string Vote = @"Vote"; 

  }

  public static class FavoriteDerivedReferenceNames
  {
    public const string SubFavorites = @"SubFavorites"; 

    public const string User = @"User"; 

    public const string Subject = @"Subject"; 

    public const string SuperFavorites = @"SuperFavorites"; 

  }

  [Serializable]
  public partial class FavoriteDerivedLoadSettings : FavoriteLoadSettings
  {

    public FavoriteDerivedLoadSettings()
    {
      OnCreate();
    }

    public new FavoriteDerivedFilterExpression Filter 
    { 
      get 
      { 
        base.Filter = FavoriteDerivedFilterExpression.FromFavoriteFilterExpression(base.Filter);
        return base.Filter as FavoriteDerivedFilterExpression;
      }
      set { base.Filter = value; }
    }

    public FavoriteDerivedSelectionSettings Selection 
    { 
      get 
      { 
        base.Selection = FavoriteDerivedSelectionSettings.FromFavoriteSelectionSettings(base.Selection);
        return base.Selection as FavoriteDerivedSelectionSettings;
      }
      set { base.Selection = value; }
    }

    public FavoriteDerivedInclusionSettings Inclusion 
    { 
      get 
      { 
        base.Inclusion = FavoriteDerivedInclusionSettings.FromFavoriteInclusionSettings(base.Inclusion);
        return base.Inclusion as FavoriteDerivedInclusionSettings;
      }
      set { base.Inclusion = value; }
    }

    public FavoriteDerivedSortingSettings Sorting 
    { 
      get 
      { 
        base.Sorting = FavoriteDerivedSortingSettings.FromFavoriteSortingSettings(base.Sorting);
        return base.Sorting as FavoriteDerivedSortingSettings;
      }
      set { base.Sorting = value; }
    }

    partial void OnCreate();

    public static new FavoriteDerivedLoadSettings FromFavoriteLoadSettings(FavoriteLoadSettings other)
    {
      if (other is FavoriteDerivedLoadSettings) return other as FavoriteDerivedLoadSettings;
      var result = new FavoriteDerivedLoadSettings();
      result.CopyFrom(other);
      return result;
    }

    public static FavoriteDerivedLoadSettings FromFavoriteDerivedLoadSettings(FavoriteDerivedLoadSettings other)
    {
      if (other != null) return other;
      var result = new FavoriteDerivedLoadSettings();
      return result;
    }

  }

  [Serializable]
  public partial class FavoriteDerivedFilterExpression : FavoriteFilterExpression 
  {
    public SimpleFilterExpression<DateTime?> DateOfCreationFilter { get; set; }

    partial void OnCreate();

    protected override void CopyFrom(FavoriteFilterExpression other)
    {
      base.CopyFrom(other);
      if (other is FavoriteDerivedFilterExpression)
      {
        var item = (FavoriteDerivedFilterExpression)other;
      }
    }

    public static new FavoriteDerivedFilterExpression FromFavoriteFilterExpression(FavoriteFilterExpression other)
    {
      if (other is FavoriteDerivedFilterExpression) return other as FavoriteDerivedFilterExpression;
      var result = new FavoriteDerivedFilterExpression();
      result.CopyFrom(other);
      return result;
    }

    public static FavoriteDerivedFilterExpression FromFavoriteDerivedFilterExpression(FavoriteDerivedFilterExpression other)
    {
      if (other != null) return other;
      var result = new FavoriteDerivedFilterExpression();
      return result;
    }

  }

  [Serializable]
  public partial class FavoriteDerivedSelectionSettings : FavoriteSelectionSettings 
  {
    public FavoriteDerivedSelectionSettings()
    {
      SelectDateOfCreation = true;

      OnCreate();
    }

    public bool SelectDateOfCreation { get; set; } 

    partial void OnCreate();

    protected override void CopyFrom(FavoriteSelectionSettings other)
    {
      base.CopyFrom(other);
      if (other is FavoriteDerivedSelectionSettings)
      {
        var item = (FavoriteDerivedSelectionSettings)other;
        SelectDateOfCreation = item.SelectDateOfCreation;
      }
    }

    public static new FavoriteDerivedSelectionSettings FromFavoriteSelectionSettings(FavoriteSelectionSettings other)
    {
      if (other is FavoriteDerivedSelectionSettings) return other as FavoriteDerivedSelectionSettings;
      var result = new FavoriteDerivedSelectionSettings();
      result.CopyFrom(other);
      return result;
    }

    public static FavoriteDerivedSelectionSettings FromFavoriteDerivedSelectionSettings(FavoriteDerivedSelectionSettings other)
    {
      if (other != null) return other;
      var result = new FavoriteDerivedSelectionSettings();
      return result;
    }

  }

  [Serializable]
  public partial class FavoriteDerivedInclusionSettings : FavoriteInclusionSettings 
  {
    public FavoriteDerivedInclusionSettings()
    {
      OnCreate();
    }

    public bool IncludeSubFavorites { get; set; }
    private FavoriteLoadSettings includedSubFavoritesSettings;
    public FavoriteLoadSettings IncludedSubFavoritesSettings 
    { 
      get
      {
        includedSubFavoritesSettings = FavoriteLoadSettings.FromFavoriteLoadSettings(includedSubFavoritesSettings);
        return includedSubFavoritesSettings;
      } 
      set
      {
        includedSubFavoritesSettings = value;
      }
    }


    partial void OnCreate();

    protected override void CopyFrom(FavoriteInclusionSettings other)
    {
      base.CopyFrom(other);
      if (other is FavoriteDerivedInclusionSettings)
      {
        var item = (FavoriteDerivedInclusionSettings)other;
        IncludeSubFavorites = item.IncludeSubFavorites;
        includedSubFavoritesSettings = item.includedSubFavoritesSettings;
      }
    }

    public static new FavoriteDerivedInclusionSettings FromFavoriteInclusionSettings(FavoriteInclusionSettings other)
    {
      if (other is FavoriteDerivedInclusionSettings) return other as FavoriteDerivedInclusionSettings;
      var result = new FavoriteDerivedInclusionSettings();
      result.CopyFrom(other);
      return result;
    }

    public static FavoriteDerivedInclusionSettings FromFavoriteDerivedInclusionSettings(FavoriteDerivedInclusionSettings other)
    {
      if (other != null) return other;
      var result = new FavoriteDerivedInclusionSettings();
      return result;
    }

  }

  [Serializable]
  public partial class FavoriteDerivedSortingSettings : FavoriteSortingSettings 
  {
    public FavoriteDerivedSortingSettings()
    {
      OnCreate();
    }


    partial void OnCreate();

    protected override void CopyFrom(FavoriteSortingSettings other)
    {
      base.CopyFrom(other);
      if (other is FavoriteDerivedSortingSettings)
      {
        var item = (FavoriteDerivedSortingSettings)other;
      }
    }

    public static new FavoriteDerivedSortingSettings FromFavoriteSortingSettings(FavoriteSortingSettings other)
    {
      if (other is FavoriteDerivedSortingSettings) return other as FavoriteDerivedSortingSettings;
      var result = new FavoriteDerivedSortingSettings();
      result.CopyFrom(other);
      return result;
    }

    public static FavoriteDerivedSortingSettings FromFavoriteDerivedSortingSettings(FavoriteDerivedSortingSettings other)
    {
      if (other != null) return other;
      var result = new FavoriteDerivedSortingSettings();
      return result;
    }

  }
}
